package com.exigen.perflabstat.services.impl;

import java.util.List;

import com.exigen.perflabstat.dao.ProjectNameDao;
import com.exigen.perflabstat.dao.ScenarioDao;
import com.exigen.perflabstat.dao.ScenarioTypeDao;
import com.exigen.perflabstat.dao.TestRawResultsDao;
import com.exigen.perflabstat.dao.TestResultsDao;
import com.exigen.perflabstat.dao.TestSummaryDao;
import com.exigen.perflabstat.dao.TestSummaryDataDao;
import com.exigen.perflabstat.dao.TransactionNameDao;
import com.exigen.perflabstat.dao.TransactionTypeDao;
import com.exigen.perflabstat.models.ProjectName;
import com.exigen.perflabstat.models.Scenario;
import com.exigen.perflabstat.models.ScenarioType;
import com.exigen.perflabstat.models.TestRawResults;
import com.exigen.perflabstat.models.TestResults;
import com.exigen.perflabstat.models.TestSummary;
import com.exigen.perflabstat.models.TestSummaryData;
import com.exigen.perflabstat.models.TransactionName;
import com.exigen.perflabstat.models.TransactionType;
import com.exigen.perflabstat.services.TableService;

public class TableServiceImpl implements TableService {

	private ProjectNameDao projectNameDao;
	private ScenarioTypeDao scenarioTypeDao;
	private TestRawResultsDao testRawResultsDao;
	private ScenarioDao scenarioDao;
	private TransactionTypeDao transactionTypeDao;
	private TransactionNameDao transactionNameDao;
	private TestResultsDao testResultsDao;
	private TestSummaryDao testSummaryDao;
	private TestSummaryDataDao testSummaryDataDao;
	
	//Returns all projectName from database
	public List<ProjectName> projectName() {
		return projectNameDao.allProjectNames();
	}


	//Saves projectName to database
	public boolean newProjectName(ProjectName projectName) {	
		if(projectNameDao.save(projectName) != null)return true;
		else return false;
	}

	
	//Deletes selected projectName from database
	public void deleteProjectName(ProjectName project) {
		projectNameDao.delete(project);
	}

	
	//Updates selected projectName in database
	public boolean editProjectName(ProjectName project) {
		if(projectNameDao.update(project) != null)return true;
		else return false;
	}
	
	
	
	
	//Returns all ScenarioType from database
	public List<ScenarioType> scenarioType() {
		return scenarioTypeDao.allScenarioTypes();
	}

	//Saves ScenarioType to database
	public boolean newScenarioType(ScenarioType scenarioType) {	
		if(scenarioTypeDao.save(scenarioType) != null)return true;
		else return false;
	}
		
	//Deletes selected ScenarioType from database
	public void deleteScenarioType(ScenarioType scenarioType) {
		scenarioTypeDao.delete(scenarioType);
	}
		
	//Updates selected ScenarioType in database
	public boolean editScenarioType(ScenarioType scenarioType) {
		if(scenarioTypeDao.update(scenarioType) != null)return true;
		else return false;
	}
	
	
	
	
	//Returns all TestRawResults from database
	public List<TestRawResults> testRawResults() {
		return testRawResultsDao.allTestRawResults();
	}

	//Saves TestRawResults to database
	public boolean newTestRawResults(TestRawResults testRawResults) {	
		if(testRawResultsDao.save(testRawResults) != null)return true;
		else return false;
	}
		
	//Deletes selected TestRawResults from database
	public void deleteTestRawResults(TestRawResults testRawResults) {
		testRawResultsDao.delete(testRawResults);
	}
		
	//Updates selected TestRawResults in database
	public boolean editTestRawResults(TestRawResults testRawResults) {
		if(testRawResultsDao.update(testRawResults) != null)return true;
		else return false;
	}
	
	
	
	//Returns all Scenario from database
	public List<Scenario> scenario() {
		return scenarioDao.allScenarios();
	}

	//Saves Scenario to database
	public boolean newScenario(Scenario scenario) {	
		if(scenarioDao.save(scenario) != null)return true;
		else return false;
	}
		
	//Deletes selected Scenario from database
	public void deleteScenario(Scenario scenario) {
		scenarioDao.delete(scenario);
	}
		
	//Updates selected Scenario in database
	public boolean editScenario(Scenario scenario) {
		if(scenarioDao.update(scenario) != null)return true;
		else return false;
	}
	
	
	
	
	//Returns all TransactionType from database
	public List<TransactionType> transactionType() {
		return transactionTypeDao.allTransactionTypes();
	}

	//Saves TransactionType to database
	public boolean newTransactionType(TransactionType transactionType) {	
		if(transactionTypeDao.save(transactionType) != null)return true;
		else return false;
	}
		
	//Deletes selected TransactionType from database
	public void deleteTransactionType(TransactionType transactionType) {
		transactionTypeDao.delete(transactionType);
	}
		
	//Updates selected TransactionType in database
	public boolean editTransactionType(TransactionType transactionType) {
		if(transactionTypeDao.update(transactionType) != null)return true;
		else return false;
	}
	
	
	
	//Returns all TransactionName from database
	public List<TransactionName> transactionName() {
		return transactionNameDao.allTransactionNames();
	}

	//Saves TransactionName to database
	public boolean newTransactionName(TransactionName transactionName) {	
		if(transactionNameDao.save(transactionName) != null)return true;
		else return false;
	}
		
	//Deletes selected TransactionName from database
	public void deleteTransactionName(TransactionName transactionName) {
		transactionNameDao.delete(transactionName);
	}
		
	//Updates selected TransactionName in database
	public boolean editTransactionName(TransactionName transactionName) {
		if(transactionNameDao.update(transactionName) != null)return true;
		else return false;
	}
	
	
	
	//Returns all TestResults from database
	public List<TestResults> testResults() {
		return testResultsDao.allTestResults();
	}

	//Saves TestResults to database
	public boolean newTestResults(TestResults testResults) {	
		if(testResultsDao.save(testResults) != null)return true;
		else return false;
	}
		
	//Deletes selected TestResults from database
	public void deleteTestResults(TestResults testResults) {
		testResultsDao.delete(testResults);
	}
		
	//Updates selected TestResults in database
	public boolean editTestResults(TestResults testResults) {
		if(testResultsDao.update(testResults) != null)return true;
		else return false;
	}
	
	
	//Returns all TestSummary from database
	public List<TestSummary> testSummary() {
		return testSummaryDao.allTestSummarys();
	}

	//Saves TestSummary to database
	public boolean newTestSummary(TestSummary testSummary) {	
		if(testSummaryDao.save(testSummary) != null)return true;
		else return false;
	}
		
	//Deletes selected TestSummary from database
	public void deleteTestSummary(TestSummary testSummary) {
		testSummaryDao.delete(testSummary);
	}
		
	//Updates selected TestSummary in database
	public boolean editTestSummary(TestSummary testSummary) {
		if(testSummaryDao.update(testSummary) != null)return true;
		else return false;
	}
	
	
	
	//Returns all TestSummaryData from database
	public List<TestSummaryData> testSummaryData() {
		return testSummaryDataDao.allTestSummaryDatas();
	}

	//Saves TestSummaryData to database
	public boolean newTestSummaryData(TestSummaryData testSummaryData) {	
		if(testSummaryDataDao.save(testSummaryData) != null)return true;
		else return false;
	}
		
	//Deletes selected TestSummaryData from database
	public void deleteTestSummaryData(TestSummaryData testSummaryData) {
		testSummaryDataDao.delete(testSummaryData);
	}
		
	//Updates selected TestSummaryData in database
	public boolean editTestSummaryData(TestSummaryData testSummaryData) {
		if(testSummaryDataDao.update(testSummaryData) != null)return true;
		else return false;
	}
	
	
	
    //Getters and Setters ----------------------------------------------------------------------------------------
	
	
	
	public ProjectNameDao getProjectNameDao() {
		return projectNameDao;
	}

	public void setProjectNameDao(ProjectNameDao projectNameDao) {
		this.projectNameDao = projectNameDao;
	}

	public ScenarioTypeDao getScenarioTypeDao() {
		return scenarioTypeDao;
	}
	
	public void setScenarioTypeDao(ScenarioTypeDao scenarioTypeDao) {
		this.scenarioTypeDao = scenarioTypeDao;
	}


	public TestRawResultsDao getTestRawResultsDao() {
		return testRawResultsDao;
	}


	public void setTestRawResultsDao(TestRawResultsDao testRawResultsDao) {
		this.testRawResultsDao = testRawResultsDao;
	}


	public ScenarioDao getScenarioDao() {
		return scenarioDao;
	}


	public void setScenarioDao(ScenarioDao scenarioDao) {
		this.scenarioDao = scenarioDao;
	}


	public TransactionTypeDao getTransactionTypeDao() {
		return transactionTypeDao;
	}


	public void setTransactionTypeDao(TransactionTypeDao transactionTypeDao) {
		this.transactionTypeDao = transactionTypeDao;
	}


	public TransactionNameDao getTransactionNameDao() {
		return transactionNameDao;
	}


	public void setTransactionNameDao(TransactionNameDao transactionNameDao) {
		this.transactionNameDao = transactionNameDao;
	}


	public TestResultsDao getTestResultsDao() {
		return testResultsDao;
	}


	public void setTestResultsDao(TestResultsDao testResultsDao) {
		this.testResultsDao = testResultsDao;
	}


	public TestSummaryDao getTestSummaryDao() {
		return testSummaryDao;
	}


	public void setTestSummaryDao(TestSummaryDao testSummaryDao) {
		this.testSummaryDao = testSummaryDao;
	}


	public TestSummaryDataDao getTestSummaryDataDao() {
		return testSummaryDataDao;
	}


	public void setTestSummaryDataDao(TestSummaryDataDao testSummaryDataDao) {
		this.testSummaryDataDao = testSummaryDataDao;
	}

}
